﻿<UserControl x:Class="personalplaner.databasewizard.views.LogonView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:p="clr-namespace:personalplaner.databasewizard.Properties"
             xmlns:conv="clr-namespace:personalplaner.common.converters;assembly=personalplaner.common">
    
    <Control.Resources>
        <conv:BoolInvertConverter x:Key="boolInvert"/>
    </Control.Resources>
    
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
        </Grid.RowDefinitions>

        <TextBlock Text="{x:Static p:Resources.LogonData}" FontSize="22" FontWeight="Thin" Foreground="#E1000000" Margin="50,-5,0,15"/>

        <Grid Grid.Row="1">
            <TextBlock Text="{x:Static p:Resources.ChooseOdbc}" FontSize="14" TextWrapping="Wrap" Margin="20,20,80,20"/>
        </Grid>
        
        <Grid Grid.Row="2" Margin="200,0,60,20">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            
            <TextBlock Text="{x:Static p:Resources.OdbcDataSource}" Grid.Row="0" VerticalAlignment="Top" Margin="0,0,5,0"/>
            <ListBox Grid.Column="1" BorderThickness="1" ItemsSource="{Binding OdbcSources}" SelectedItem="{Binding SelectedOdbcSource}"/>

            <TextBlock Text="{x:Static p:Resources.DatabaseAdmin}" Grid.Row="1" Margin="0,0,5,0" />
            <TextBox Grid.Column="1" Grid.Row="1" Text="{Binding User}"/>

            <TextBlock Text="{x:Static p:Resources.Password}" Grid.Row="2" Margin="0,0,5,0" />
            <PasswordBox Grid.Column="1" Grid.Row="2" PasswordChanged="PasswordBox_PasswordChanged" Name="txtPassword"/>

            <TextBlock Text="{x:Static p:Resources.NewDatabase}" Grid.Row="3" Margin="0,0,5,0" />
            <CheckBox Grid.Column="1" Grid.Row="3" IsChecked="{Binding IsNewDatabase}"/>

            <TextBlock Text="{x:Static p:Resources.Database}" Grid.Row="4" Margin="0,0,5,0" VerticalAlignment="Top"/>
            <ListBox Grid.Column="1" Grid.Row="4" BorderThickness="1" ItemsSource="{Binding Databases}" SelectedItem="{Binding SelectedDatabase}" IsEnabled="{Binding IsNewDatabase, Converter={StaticResource boolInvert}}"/>

        </Grid>
        
    </Grid>
</UserControl>
